﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AntiObesity.Utilities.Wire
{
    public class Row
    {
        public Row()
        {
            Cells = new List<Cell>();
        }

        public List<Cell> Cells { get; private set; }

        public void AddCell(string value)
        {
            Cells.Add(new Cell { Value = value });
        }

        public string ToJSON()
        {
            var sb = new StringBuilder();

            sb.Append("{c:[");
            foreach (var cell in Cells)
            {
                sb.Append(cell.ToJSON());
                if (cell != Cells.Last())
                    sb.Append(",");

            }
            sb.Append("]}");
            return sb.ToString();
        }

    }
}
